<template>
	<div>
		<config v-model:config="data.config" />
		<el-button @click="save()">保存</el-button>
	</div>
</template>

<script>
	import {
		ElMessage
	} from 'element-plus'
	import {
		getTags,
		getConfig,
		saveConfig
	} from '/@/api/system.js'
	import {
		reactive,
		onMounted,
		toRefs,
		computed,
		ref,
	} from 'vue'
	import config from '/@/components/from/SystemConfig.vue'
	import {
		useRoute
	} from "vue-router"
	export default {
		name: "systemTagOnce",
		components: {
			config
		},
		setup() {
			const route = useRoute(); // 第一步
			const data = reactive({
				config: []
			})
			const activeName = ref(0);
			const save = () => {

				let dd = data.config;

				if (dd && dd.length > 0) {
					saveConfig(dd).then(res => {
						ElMessage({
							message: res.message || '保存成功',
							type: 'success',
							duration: 3000
						})
					})
				}

			}
			const changeTag = (tab, event) => {
				console.log(tab, event, '>>>>')
			}

			const getConfigList = (tid) => {
				getConfig({
					tid: tid
				}).then(res => {
					data.config = res.data
				})
			}

			onMounted(() => {
				getConfigList(route.query.id)

			})

			return {
				data,
				save,

			}
		}
	}
</script>

<style>
</style>